package com.shilei.cor;

import com.shilei.GameObject;
import com.shilei.Tank;
import com.shilei.Wall;
import com.shilei.common.Group;

/**
 * @description: 坦克墙碰撞
 * @author: 81271
 * @date: 2020-04-15 20:17
 */
public class TankWallCollider implements Collider {

    @Override
    public boolean collide(GameObject go1, GameObject go2) {
        if (go1 instanceof Tank && go2 instanceof Wall) {
            Tank tank1 = (Tank)go1;
            Wall wall = (Wall)go2;

            if (tank1.getRect().intersects(wall.getRect())) {
                tank1.restoration();
            }

        } else if (go1 instanceof Wall && go2 instanceof Tank) {
            collide(go2, go1);
        }
        return false;



    }

}
